package com.neusoft.yuejian_6.model;

import com.neusoft.yuejian_6.javabean.Train;
import com.neusoft.yuejian_6.javabean.Trainn;
import com.neusoft.yuejian_6.service.TrainService;

import java.util.List;

import retrofit2.Call;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

import static com.neusoft.yuejian_6.base.Constant.BASE_URL;

public class TrainModel {
    private Retrofit retrofit;

    public TrainModel() {
        retrofit = new Retrofit.Builder()
                .baseUrl("http://10.0.2.2/neu1_yuejian/index.php/Api/")
                .addConverterFactory(GsonConverterFactory.create())
                .build();
    }

    //培训列表
    public Call<List<Train>> getTrainlist() {
        TrainService trainService = retrofit.create(TrainService.class);
        return trainService.getTrainlist();
    }
    //培训详情
    public Call<Train> gettraindetail(int train_id){
        TrainService trainService = retrofit.create(TrainService.class);
        return trainService.gettraindetail(train_id);
    }

    //菜鸟列表
    public Call<List<Train>> getCainiaoTrainlist() {
        TrainService trainService = retrofit.create(TrainService.class);
        return trainService.getCainiaoTrainlist();
    }

    //入门列表
    public Call<List<Train>> getRumenTrainlist() {
        TrainService trainService = retrofit.create(TrainService.class);
        return trainService.getRumenTrainlist();

    }

    //进阶列表
    public Call<List<Train>> getJinjieTrainlist() {
        TrainService trainService = retrofit.create(TrainService.class);
        return trainService.getJinjieTrainlist();

    }

    //报名培训
    public Call<Trainn> addtrainn(int user_id, int trainn_id){
        TrainService trainService = retrofit.create(TrainService.class);
        return trainService.addtrainn(user_id,trainn_id);
    }


    //搜索
    public Call<List<Train>> searchTrain(String train_name){
        TrainService trainService = retrofit.create(TrainService.class);
        return  trainService.searchTrain(train_name);
    }


}
